package io;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("test1.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos);

        String str = "夜空中最亮的星，请指引我前行";
        byte[] data = str.getBytes(StandardCharsets.UTF_8);
        bos.write(data);
        bos.flush();
        System.out.println("写出完毕");
        bos.close();
    }
}
